//Unit test for isGameOver

#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <assert.h>

#define _NUM_TESTS 100

void fail(int n) {
    printf("FAIL !!!\n");
    exit(0);
}

int main() {
	srand(time(NULL));

	int i;
	int j = 0;
	int result;
	struct gameState state;

	int test = 0;
	while(test++ != _NUM_TESTS) {
		j = 0;
		for(i = 0; i < 27; ++i) {
			state.supplyCount[i] = rand() % 10;
			if(state.supplyCount[i] == 0)
				++j;
		}
		
		result = isGameOver(&state);
		
		if(state.supplyCount[province] == 0 && result != 1)
            fail(1);
		else if(j >= 3 && result != 1)
            fail(1);
        else if(result != 0)
		    fail(1);
	}
	
	printf("Passed.\n");
	return 0;
}
